package iterator.television.concrete_television;

import iterator.iterator.TVIterator;
import iterator.television.Television;

public class HaierTelevision implements Television {
    private Object[] objects = {"CCTV-1","CCTV-2","CCTV-3","CCTV-4","CCTV-5","CCTV-6"};
    @Override
    public TVIterator getIterator(){
        return new HaierIterator();
    }
    public class HaierIterator implements TVIterator {
        private int index = 0;
        public void previous()
        {
            if(index > 0){
                index--;
            }
        }
        public void next()
        {
            if(index < objects.length){
                index++;
            }
        }
        public void setChannel(int i){
            index = i;
        }
        public Object currentChannel(){
            return objects[index];
        }
        public boolean isLast(){
            return index == objects.length;
        }
        public boolean isFirst(){
            return index == 0;
        }
    }
}
